<extend name="Public/base"/>
<block name="head">
	<link href="__CSS__/article.css" rel="stylesheet">
</block>
<block name="body">
	<div class="container" >
		
        <div class="row">
			<div class="col-md-12 article-list" id="ajax-article-list">
				<ul>
					<volist name="_list"  id="list">					
						<li style="<if condition='$i%4 gt 0'>margin-right:1%;</if>">
							<a href="{:U('Article/detail?id='.$list['id'])}">
								<div class="cover" style="background:url('{$list.cover_id|get_cover=path}') repeat scroll 50% 50% / cover">
								
								</div>		
								
									<div class="title">
										{$list.title}
									</div>
								
								<div class="disc">
									{$list.description}
								</div>
								<div class="view-info">
									<span class="view">
										<i class="glyphicon glyphicon-eye-open"></i>
										{$list.view}
									</span>
								</div>
							</a>
						</li>
					</volist>
				</ul>
				<button id="next" class="btn" p="2" total-page="{$total_page}">
					点击加载更多
				</button>
				

			</div>
	
        </div>
    </div>
</block>
<block name="script">
<script>
	 $(function(){   
		  $('#next').click(function(){
		  	LoadPage();  
		  }); 
	}); 
	function LoadPage(){
		var currentPage = $('#next').attr('p') ? $('#next').attr('p') : 1;
		$.get("{:U('Article/ajaxTag?id='.$tag)}",{p:currentPage},function(result){
			if(result.errno==0){
				$('#ajax-article-list').append(result.content);
				$('#next').attr('p',result.p);
				if(result.p>=$('#next').attr('total-page')){
					$('#next').html('木有了，亲');
					$('#next').attr('disabled',true);
					$('#next').addClass('disabled');
				}
			}
			
		},'json');	
	}
</script>
</block>